package com.kushe.util;

import com.kushe.dao.CategoryDao;
import com.kushe.dao.SortDao;
import com.kushe.util.core.Controller;
import com.kushe.util.core.DaoFactory;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by WhiteBlue on 15/5/2.
 */
public class KSController extends Controller {
    @Override
    public ModelAndView render(String fileName) {
        if ((this.getAttr("categories") == null)||(this.getAttr("sorts") == null)) {
            this.setAttr("categories", DaoFactory.getDao(CategoryDao.class).listAll());
            this.setAttr("sorts", DaoFactory.getDao(SortDao.class).listAll());
        }
        return super.render(fileName);
    }
}
